pragma License (GPL);
--
-- drk-bigrat.ads
--
-- Copyright (C) 2012 - Thibault BUREL
--
-- This file is part of DRK.BigRat.
--
-- DRK.BigRat is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- DRK.BigRat is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with DRK.BigRat.  If not, see <http://www.gnu.org/licenses/>
--
with DRK.BigInt;

package DRK.BigRat is

   type Instance is private;

   ----------------------
   --  Init functions  --
   ----------------------

   function Init (Num, Den : in Natural) return Instance;

   function Init_Pow_10 (Exp : in Integer) return Instance;
   --  This function returns a new bigrat computed by 10^Exp.
   --  This is especially usefull for setting accuracy.

   procedure Set_Precision (P : in Instance);
   --  This function allows to set the accuracy of the result displayed.

   ----------------------------
   --  Comparison functions  --
   ----------------------------

   function "="  (Left, Right : in Instance) return Boolean;
   function "<"  (Left, Right : in Instance) return Boolean;
   function ">"  (Left, Right : in Instance) return Boolean;
   function "<=" (Left, Right : in Instance) return Boolean;
   function ">=" (Left, Right : in Instance) return Boolean;

   ------------------------
   --  Binary operators  --
   ------------------------

   function "+" (Left, Right : in Instance) return Instance;
   function "-" (Left, Right : in Instance) return Instance;
   function "*" (Left, Right : in Instance) return Instance;
   function "/" (Left, Right : in Instance) return Instance;

private

   type Instance is record
      Pos : Boolean;
      Num : BigInt.Instance;
      Den : BigInt.Instance;
   end record;

   Default_Precision : constant := -10;

   Epsilon : Instance;

end DRK.BigRat;
